package snail.controllers;

import javax.servlet.http.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import snail.misc.PreparedModelAndView;
import snail.model.User;

public class WatchedArticlesController extends MultiActionController {

    public ModelAndView index(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView mv = new PreparedModelAndView("watchedarticles/index", request);
        User u = (User) request.getSession().getAttribute("user");
        if(u == null)
            return new UserController().login(request, response, "../watchedarticles/");
        
        mv.addObject("userid", u.getUserId());
        return mv;
    }
}
